import { Injectable } from '@nestjs/common';
import { EntityManager } from 'typeorm';
import { InjectEntityManager } from '@nestjs/typeorm';
import { User } from './entity/user.entity';

@Injectable()
export class UsersService {
  @InjectEntityManager()
  entityManager: EntityManager;

  async findOne(username: string): Promise<User | null> {
    return await this.entityManager.findOne(User, { where: { username } });
  }
}
